<template>
  <div>
      <van-uploader :after-read="onRead" accept="image/png, image/jpg" multiple>
        <van-icon name="photograph"/>
      </van-uploader>
  </div>
</template>


<script>
import axios from 'axios';
export default {
  data() {
    return {
      showList1: true,
      scrollTop: 0,
      onFetching: false,
      bottomCount: 20,
      offon: false
    };
  },
  mounted() {
  },
  methods: {
     onRead(file, content) {
      console.log(file); 
      let params = new FormData(); //创建form对象
      params.append("file", file.file); 
      params.append("unionid", this.appJS.getStorage('user').shop_unionid); 
      params.append("version", '1.1'); 
      
      let config = {
        headers: {
          //添加请求头
          Authorization:
            "Bearer " + window.localStorage.getItem("managementToken"),
          "Content-Type": "multipart/form-data"
        }
      };
      let url = "";
      axios
        .post('/api/uri/fileupload/upload', params, config)
        .then(res => {
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
  }
};
</script>

<style scoped>
.box1 {
  height: 100px;
  position: relative;
  width: 1490px;
}
.box1-item {
  width: 200px;
  height: 100px;
  background-color: #ccc;
  display: inline-block;
  margin-left: 15px;
  float: left;
  text-align: center;
  line-height: 100px;
}
.box1-item:first-child {
  margin-left: 0;
}
.box2-wrap {
  height: 300px;
  overflow: hidden;
}
</style>